import { Vector2 } from "../vector";  
import { Engine } from "../engine";  
  
export abstract class CameraEffect {  
  public engine: Engine;  
  public startTime: number = 0;  
  public duration: number = 0;  
  public isActive: boolean = false;  
  
  constructor(engine: Engine) {  
    this.engine = engine;  
  }  
  
  start(duration: number = 1000): void {  
    this.startTime = this.engine.time_;  
    this.duration = duration;  
    this.isActive = true;  
  }  
  
  stop(): void {  
    this.isActive = false;  
  }  
  
  get progress(): number {  
    if (!this.isActive) return 0;  
    const elapsed = this.engine.time_ - this.startTime;  
    return Math.min(elapsed / this.duration, 1);  
  }  
  
  get isFinished(): boolean {  
    return this.isActive && this.progress >= 1;  
  }  
  
  abstract apply(basePos: Vector2): Vector2;  
}